import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UserModule } from './user/user.module';
import { User2Module } from './user2/user2.module';
import { UseAopModule } from './use-aop/use-aop.module';
import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
import { UseAopGuard } from './use-aop/use-aop.guard';
import { TimoutInterceptor } from './timout/timout.interceptor';

@Module({
  imports: [UserModule, User2Module, UseAopModule],
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: APP_GUARD,
      useClass: UseAopGuard,
    },
    // 全局使用拦截器
    // {
    //   provide: APP_INTERCEPTOR,
    //   useClass: TimoutInterceptor,
    // },
  ],
})
export class AppModule {}
